package com.mdp.workflow.biz.hi.ctrl;

import cn.hutool.core.lang.Assert;
import com.mdp.core.entity.Result;
import com.mdp.workflow.api.FlowActivityService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

 import static com.mdp.core.entity.Result.ok;

@Tag(name = "管理后台 - 流程活动实例")
@RestController
@RequestMapping("/*/hi/activity")
@Validated
public class ActivityController {

    @Resource
    private FlowActivityService activityService;

    @GetMapping("/list")
    @Operation(summary = "生成指定流程实例的高亮流程图",
            description = "只高亮进行中的任务。不过要注意，该接口暂时没用，通过前端的 ProcessViewer.vue 界面的 highlightDiagram 方法生成")
      public Result getActivityList(
            @RequestParam("procInstId") String procInstId) {
        Assert.notNull(procInstId);
        return ok().setData(activityService.getActivityListByProcessInstanceId(procInstId));
    }
}
